{include file="public/layout" /}

<body>
<link rel="stylesheet" href="__SKIN__/css/page.css" media="all">

<div class="layui-fluid" id="LAY-component-layer-list">
    <div class="layui-card">
        <div class="head-oper">
            <div class="fl">
                <a href="javascript:;" class="layui-btn select">
                    <i class="fa fa-pencil-square-o"></i>确认选择
                </a>
            </div>
            <div class="fr">
                <form action="{:url('Minipro/ajax_archives_list_pic')}" id="searchForm" method="get" onsubmit="layer_loading();">
                    {$searchform.hidden|default=''}
                    <div class="fl " >
                        <div class="layui-input-inline mt5">
                            {gt name='$typeidNum' value='1'}
                            <select name="typeid" id="searchTypeid">
                                <option value="">--所有文档--</option>
                                {$arctype_html}
                            </select>
                            {/gt}
                        </div>
                        <div class="layui-input-inline w240 mt5">
                            <input type="text" name="keywords" id="keywords" value="{$Request.param.keywords}" placeholder="标题搜索" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-input-inline w50 mt5">
                        <input type="hidden" name="func" value="{$func}">
                        <input type="hidden" name="sort" value="{$sort}">
                        <button class="layui-btn input-btn-search" type="submit"><i class="layui-icon layui-icon-search"></i></button>
                    </div>
                </form>
            </div>
        </div>
        <div class="layui-card-body">
            <div class="layui-form layui-border-box layui-table-view house-table"  lay-filter="demo" lay-id="admin-arctype" >
                <div class="layui-table-box">
                    <div class="layui-table-body " >
                        <table cellspacing="0" cellpadding="0" border="0" class="layui-table layui-form" lay-skin="line" style="width: 100%">
                            <thead >
                            <tr>
                                <th class="w40 tc">

                                </th>
                                <th class="w60 tc"> <div class="layui-table-cell w60 tc" ><span>ID</span></div></th>
                                <th class="wauto"> <div class="layui-table-cell wauto"><span>标题</span></div></th>
                                <th class="w100 tc"> <div class="layui-table-cell w100 tc"><span>所属栏目</span></div></th>
                                <th class="w80 tc"> <div class="layui-table-cell w80 tc"><span>浏览量</span></div></th>
                                <th class="w110 tc"> <div class="layui-table-cell w110 tc"><span>更新时间</span></div></th>
                            </tr>
                            </thead>
                            <tbody>
                            {empty name="list"}
                            <tr>
                                <td class="no-data" align="center" axis="col0" colspan="9">
                                    <i class="fa fa-exclamation-circle"></i>没有符合条件的数据
                                </td>
                            </tr>
                            {else /}
                            {foreach name="list" item="vo" key="k" }
                            <tr>
                                <td>
                                    <div class="layui-table-cell w40 tc laytable-cell-checkbox">
                                        <input type="checkbox" name="ids[]" value="{$vo.aid}" data-title="{$vo.title}" lay-filter="ids" lay-skin="primary">
                                    </div>
                                </td>
                                <td><div class="layui-table-cell w60 tc"> {$vo.aid} </div></td>
                                <td>
                                    <div class="layui-table-cell wauto" title=" ">
                                        {eq name="$Think.const.CONTROLLER_NAME.'@edit'|is_check_access" value="1"}
                                        <a href="javascript:void(0);" data-url="{:url('Article/edit',array('id'=>$vo['aid']))}" class="eju-event" data-type="Article_edit" style="{eq name="vo.is_b" value="1"} font-weight: bold;{/eq}">{$vo.title}</a>
                                        {else /}
                                        {$vo.title}
                                        {/eq}
                                        {assign name='showArcFlagData' value='$vo|showArchivesFlagStr'}
                                        {$vo.showArchivesFlagStr}
                                        {volist name='$showArcFlagData' id="vo1"}
                                            {eq name='$i' value='1'}<span style="color: red;">[{/eq}
                                            <b style="font-size: 12px;">{$vo1['small_name']}</b>
                                            {eq name='$i' value='$showArcFlagData|count'}]</span>{/eq}
                                        {/volist}
                                    </div>
                                </td>
                                <td>
                                    <div class="layui-table-cell w100 tc">
                                        <a href="{:url('Article/index', array('typeid'=>$vo['typeid']))}">{$vo.typename|default='<i class="red">数据出错！</i>'}</a>
                                    </div>
                                </td>
                                <td>
                                    <div class="layui-table-cell w80 tc">
                                        {$vo.click}
                                    </div>
                                </td>
                                <td><div class="layui-table-cell w110 tc">  {$vo.update_time|date='Y-m-d',###} </div></td>

                            </tr>
                            {/foreach}
                            {/empty}
                            </tbody>
                        </table>
                    </div>
                </div>
                <!--分页-->

            </div>
            {$page}
        </div>
    </div>
</div>

<script>
    var aids = '';
    layui.config({
        base: '__SKIN__/' //静态资源所在路径
        ,version: '{$version}'
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table'], function(){
        var $ = layui.$
            ,form = layui.form
            ,table = layui.table;

        /* 触发事件 */
        var active = {
            
        };

        $('#LAY-component-layer-list .layui-btn,.eju-event').on('click', function(){
            var type = $(this).data('type');
            active[type] && active[type].call(this);
        });

        $('#searchTypeid').change(function(){
            $('#searchForm').submit();
        });

        // 监听每行复选框
        form.on('checkbox(ids)', function(data){
            if (data.elem.checked && $('input[name*=ids]:checked').length == $('input[name*=ids]').length) {
                $('.checkAll').attr('checked', true);
            } else {
                $('.checkAll').attr('checked', false);
            }
            form.render('checkbox');
        });
    });

    $('.select').on('click',function(){
        var callback = "{$func}";
        var sort = "{$sort}";
        var fileurl_tmp = [];
        var a = [], k = 0, aids = '',titles='';
        $('input[name*=ids]').each(function(i,o){
            if($(o).is(':checked')){
                a.push($(o).val());
                if (k > 0) {
                    aids += ',';
                    titles += ',';
                }
                aids += $(o).val();
                titles += $(o).data('title');
                k++;
            }
        });
        fileurl_tmp['id'] = aids;
        fileurl_tmp['titles'] = titles;
        fileurl_tmp['sort'] = sort;
        eval('window.parent.'+callback+'(fileurl_tmp)');
        window.parent.layer.closeAll();
    });

</script>
{include file="public/footer" /}
